{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## 11.10 \u5728\u7f51\u7edc\u670d\u52a1\u4e2d\u52a0\u5165SSL\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### \u95ee\u9898\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u4f60\u60f3\u5b9e\u73b0\u4e00\u4e2a\u57fa\u4e8esockets\u7684\u7f51\u7edc\u670d\u52a1\uff0c\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u901a\u8fc7SSL\u534f\u8bae\u8ba4\u8bc1\u5e76\u52a0\u5bc6\u4f20\u8f93\u7684\u6570\u636e\u3002"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### \u89e3\u51b3\u65b9\u6848\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "ssl \u6a21\u5757\u80fd\u4e3a\u5e95\u5c42socket\u8fde\u63a5\u6dfb\u52a0SSL\u7684\u652f\u6301\u3002\nssl.wrap_socket() \u51fd\u6570\u63a5\u53d7\u4e00\u4e2a\u5df2\u5b58\u5728\u7684socket\u4f5c\u4e3a\u53c2\u6570\u5e76\u4f7f\u7528SSL\u5c42\u6765\u5305\u88c5\u5b83\u3002\n\u4f8b\u5982\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5e94\u7b54\u670d\u52a1\u5668\uff0c\u80fd\u5728\u670d\u52a1\u5668\u7aef\u4e3a\u6240\u6709\u5ba2\u6237\u7aef\u8fde\u63a5\u505a\u8ba4\u8bc1\u3002"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from socket import socket, AF_INET, SOCK_STREAM\nimport ssl\n\nKEYFILE = 'server_key.pem'   # Private key of the server\nCERTFILE = 'server_cert.pem' # Server certificate (given to client)\n\ndef echo_client(s):\n    while True:\n        data = s.recv(8192)\n        if data == b'':\n            break\n        s.send(data)\n    s.close()\n    print('Connection closed')\n\ndef echo_server(address):\n    s = socket(AF_INET, SOCK_STREAM)\n    s.bind(address)\n    s.listen(1)\n\n    # Wrap with an SSL layer requiring client certs\n    s_ssl = ssl.wrap_socket(s,\n                            keyfile=KEYFILE,\n                            certfile=CERTFILE,\n                            server_side=True\n                            )\n    # Wait for connections\n    while True:\n        try:\n            c,a = s_ssl.accept()\n            print('Got connection', c, a)\n            echo_client(c)\n        except Exception as e:\n            print('{}: {}'.format(e.__class__.__name__, e))\n\necho_server(('', 20000))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u4e0b\u9762\u6211\u4eec\u6f14\u793a\u4e00\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u5668\u7684\u4ea4\u4e92\u4f8b\u5b50\u3002\u5ba2\u6237\u7aef\u4f1a\u8bf7\u6c42\u670d\u52a1\u5668\u6765\u8ba4\u8bc1\u5e76\u786e\u8ba4\u8fde\u63a5\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from socket import socket, AF_INET, SOCK_STREAM\nimport ssl\ns = socket(AF_INET, SOCK_STREAM)\ns_ssl = ssl.wrap_socket(s,"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "s_ssl.connect(('localhost', 20000))\ns_ssl.send(b'Hello World?')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "s_ssl.recv(8192)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u8fd9\u79cd\u76f4\u63a5\u5904\u7406\u5e95\u5c42socket\u65b9\u5f0f\u6709\u4e2a\u95ee\u9898\u5c31\u662f\u5b83\u4e0d\u80fd\u5f88\u597d\u7684\u8ddf\u6807\u51c6\u5e93\u4e2d\u5df2\u5b58\u5728\u7684\u7f51\u7edc\u670d\u52a1\u517c\u5bb9\u3002\n\u4f8b\u5982\uff0c\u7edd\u5927\u90e8\u5206\u670d\u52a1\u5668\u4ee3\u7801\uff08HTTP\u3001XML-RPC\u7b49\uff09\u5b9e\u9645\u4e0a\u662f\u57fa\u4e8e socketserver \u5e93\u7684\u3002\n\u5ba2\u6237\u7aef\u4ee3\u7801\u5728\u4e00\u4e2a\u8f83\u9ad8\u5c42\u4e0a\u5b9e\u73b0\u3002\u6211\u4eec\u9700\u8981\u53e6\u5916\u4e00\u79cd\u7a0d\u5fae\u4e0d\u540c\u7684\u65b9\u5f0f\u6765\u5c06SSL\u6dfb\u52a0\u5230\u5df2\u5b58\u5728\u7684\u670d\u52a1\u4e2d\uff1a"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u9996\u5148\uff0c\u5bf9\u4e8e\u670d\u52a1\u5668\u800c\u8a00\uff0c\u53ef\u4ee5\u901a\u8fc7\u50cf\u4e0b\u9762\u8fd9\u6837\u4f7f\u7528\u4e00\u4e2amixin\u7c7b\u6765\u6dfb\u52a0SSL\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import ssl\n\nclass SSLMixin:\n    '''\n    Mixin class that adds support for SSL to existing servers based\n    on the socketserver module.\n    '''\n    def __init__(self, *args,\n                 keyfile=None, certfile=None, ca_certs=None,\n                 cert_reqs=ssl.CERT_NONE,\n                 **kwargs):\n        self._keyfile = keyfile\n        self._certfile = certfile\n        self._ca_certs = ca_certs\n        self._cert_reqs = cert_reqs\n        super().__init__(*args, **kwargs)\n\n    def get_request(self):\n        client, addr = super().get_request()\n        client_ssl = ssl.wrap_socket(client,\n                                     keyfile = self._keyfile,\n                                     certfile = self._certfile,\n                                     ca_certs = self._ca_certs,\n                                     cert_reqs = self._cert_reqs,\n                                     server_side = True)\n        return client_ssl, addr"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u4e3a\u4e86\u4f7f\u7528\u8fd9\u4e2amixin\u7c7b\uff0c\u4f60\u53ef\u4ee5\u5c06\u5b83\u8ddf\u5176\u4ed6\u670d\u52a1\u5668\u7c7b\u6df7\u5408\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u662f\u5b9a\u4e49\u4e00\u4e2a\u57fa\u4e8eSSL\u7684XML-RPC\u670d\u52a1\u5668\u4f8b\u5b50\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "# XML-RPC server with SSL\n\nfrom xmlrpc.server import SimpleXMLRPCServer\n\nclass SSLSimpleXMLRPCServer(SSLMixin, SimpleXMLRPCServer):\n    pass\n\nHere's the XML-RPC server from Recipe 11.6 modified only slightly to use SSL:\n\nimport ssl\nfrom xmlrpc.server import SimpleXMLRPCServer\nfrom sslmixin import SSLMixin\n\nclass SSLSimpleXMLRPCServer(SSLMixin, SimpleXMLRPCServer):\n    pass\n\nclass KeyValueServer:\n    _rpc_methods_ = ['get', 'set', 'delete', 'exists', 'keys']\n    def __init__(self, *args, **kwargs):\n        self._data = {}\n        self._serv = SSLSimpleXMLRPCServer(*args, allow_none=True, **kwargs)\n        for name in self._rpc_methods_:\n            self._serv.register_function(getattr(self, name))\n\n    def get(self, name):\n        return self._data[name]\n\n    def set(self, name, value):\n        self._data[name] = value\n\n    def delete(self, name):\n        del self._data[name]\n\n    def exists(self, name):\n        return name in self._data\n\n    def keys(self):\n        return list(self._data)\n\n    def serve_forever(self):\n        self._serv.serve_forever()\n\nif __name__ == '__main__':\n    KEYFILE='server_key.pem'    # Private key of the server\n    CERTFILE='server_cert.pem'  # Server certificate\n    kvserv = KeyValueServer(('', 15000),\n                            keyfile=KEYFILE,\n                            certfile=CERTFILE)\n    kvserv.serve_forever()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u4f7f\u7528\u8fd9\u4e2a\u670d\u52a1\u5668\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u666e\u901a\u7684 xmlrpc.client \u6a21\u5757\u6765\u8fde\u63a5\u5b83\u3002\n\u53ea\u9700\u8981\u5728URL\u4e2d\u6307\u5b9a https: \u5373\u53ef\uff0c\u4f8b\u5982\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from xmlrpc.client import ServerProxy\ns = ServerProxy('https://localhost:15000', allow_none=True)\ns.set('foo','bar')\ns.set('spam', [1, 2, 3])\ns.keys()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "s.get('foo')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "s.get('spam')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "s.delete('spam')\ns.exists('spam')"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u5bf9\u4e8eSSL\u5ba2\u6237\u7aef\u6765\u8bb2\u4e00\u4e2a\u6bd4\u8f83\u590d\u6742\u7684\u95ee\u9898\u662f\u5982\u4f55\u786e\u8ba4\u670d\u52a1\u5668\u8bc1\u4e66\u6216\u4e3a\u670d\u52a1\u5668\u63d0\u4f9b\u5ba2\u6237\u7aef\u8ba4\u8bc1\uff08\u6bd4\u5982\u5ba2\u6237\u7aef\u8bc1\u4e66\uff09\u3002\n\u4e0d\u5e78\u7684\u662f\uff0c\u6682\u65f6\u8fd8\u6ca1\u6709\u4e00\u4e2a\u6807\u51c6\u65b9\u6cd5\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u9700\u8981\u81ea\u5df1\u53bb\u7814\u7a76\u3002\n\u4e0d\u8fc7\uff0c\u4e0b\u9762\u7ed9\u51fa\u4e00\u4e2a\u4f8b\u5b50\uff0c\u7528\u6765\u5efa\u7acb\u4e00\u4e2a\u5b89\u5168\u7684XML-RPC\u8fde\u63a5\u6765\u786e\u8ba4\u670d\u52a1\u5668\u8bc1\u4e66\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "from xmlrpc.client import SafeTransport, ServerProxy\nimport ssl\n\nclass VerifyCertSafeTransport(SafeTransport):\n    def __init__(self, cafile, certfile=None, keyfile=None):\n        SafeTransport.__init__(self)\n        self._ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)\n        self._ssl_context.load_verify_locations(cafile)\n        if certfile:\n            self._ssl_context.load_cert_chain(certfile, keyfile)\n        self._ssl_context.verify_mode = ssl.CERT_REQUIRED\n\n    def make_connection(self, host):\n        # Items in the passed dictionary are passed as keyword\n        # arguments to the http.client.HTTPSConnection() constructor.\n        # The context argument allows an ssl.SSLContext instance to\n        # be passed with information about the SSL configuration\n        s = super().make_connection((host, {'context': self._ssl_context}))\n\n        return s\n\n# Create the client proxy\ns = ServerProxy('https://localhost:15000',\n                transport=VerifyCertSafeTransport('server_cert.pem'),\n                allow_none=True)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u670d\u52a1\u5668\u5c06\u8bc1\u4e66\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\uff0c\u5ba2\u6237\u7aef\u6765\u786e\u8ba4\u5b83\u7684\u5408\u6cd5\u6027\u3002\u8fd9\u79cd\u786e\u8ba4\u53ef\u4ee5\u662f\u76f8\u4e92\u7684\u3002\n\u5982\u679c\u670d\u52a1\u5668\u60f3\u8981\u786e\u8ba4\u5ba2\u6237\u7aef\uff0c\u53ef\u4ee5\u5c06\u670d\u52a1\u5668\u542f\u52a8\u4ee3\u7801\u4fee\u6539\u5982\u4e0b\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "if __name__ == '__main__':\n    KEYFILE='server_key.pem'   # Private key of the server\n    CERTFILE='server_cert.pem' # Server certificate\n    CA_CERTS='client_cert.pem' # Certificates of accepted clients\n\n    kvserv = KeyValueServer(('', 15000),\n                            keyfile=KEYFILE,\n                            certfile=CERTFILE,\n                            ca_certs=CA_CERTS,\n                            cert_reqs=ssl.CERT_REQUIRED,\n                            )\n    kvserv.serve_forever()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u4e3a\u4e86\u8ba9XML-RPC\u5ba2\u6237\u7aef\u53d1\u9001\u8bc1\u4e66\uff0c\u4fee\u6539 ServerProxy \u7684\u521d\u59cb\u5316\u4ee3\u7801\u5982\u4e0b\uff1a"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "# Create the client proxy\ns = ServerProxy('https://localhost:15000',\n                transport=VerifyCertSafeTransport('server_cert.pem',\n                                                  'client_cert.pem',\n                                                  'client_key.pem'),\n                allow_none=True)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### \u8ba8\u8bba\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u8bd5\u7740\u53bb\u8fd0\u884c\u672c\u8282\u7684\u4ee3\u7801\u80fd\u6d4b\u8bd5\u4f60\u7684\u7cfb\u7edf\u914d\u7f6e\u80fd\u529b\u548c\u7406\u89e3SSL\u3002\n\u53ef\u80fd\u6700\u5927\u7684\u6311\u6218\u662f\u5982\u4f55\u4e00\u6b65\u6b65\u7684\u83b7\u53d6\u521d\u59cb\u914d\u7f6ekey\u3001\u8bc1\u4e66\u548c\u5176\u4ed6\u6240\u9700\u4f9d\u8d56\u3002"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u6211\u89e3\u91ca\u4e0b\u5230\u5e95\u9700\u8981\u5565\uff0c\u6bcf\u4e00\u4e2aSSL\u8fde\u63a5\u7ec8\u7aef\u4e00\u822c\u90fd\u4f1a\u6709\u4e00\u4e2a\u79c1\u94a5\u548c\u4e00\u4e2a\u7b7e\u540d\u8bc1\u4e66\u6587\u4ef6\u3002\n\u8fd9\u4e2a\u8bc1\u4e66\u5305\u542b\u4e86\u516c\u94a5\u5e76\u5728\u6bcf\u4e00\u6b21\u8fde\u63a5\u7684\u65f6\u5019\u90fd\u4f1a\u53d1\u9001\u7ed9\u5bf9\u65b9\u3002\n\u5bf9\u4e8e\u516c\u5171\u670d\u52a1\u5668\uff0c\u5b83\u4eec\u7684\u8bc1\u4e66\u901a\u5e38\u662f\u88ab\u6743\u5a01\u8bc1\u4e66\u673a\u6784\u6bd4\u5982Verisign\u3001Equifax\u6216\u5176\u4ed6\u7c7b\u4f3c\u673a\u6784\uff08\u9700\u8981\u4ed8\u8d39\u7684\uff09\u7b7e\u540d\u8fc7\u7684\u3002\n\u4e3a\u4e86\u786e\u8ba4\u670d\u52a1\u5668\u7b7e\u540d\uff0c\u5ba2\u6237\u7aef\u56de\u4fdd\u5b58\u4e00\u4efd\u5305\u542b\u4e86\u4fe1\u4efb\u6388\u6743\u673a\u6784\u7684\u8bc1\u4e66\u5217\u8868\u6587\u4ef6\u3002\n\u4f8b\u5982\uff0cweb\u6d4f\u89c8\u5668\u4fdd\u5b58\u4e86\u4e3b\u8981\u7684\u8ba4\u8bc1\u673a\u6784\u7684\u8bc1\u4e66\uff0c\u5e76\u4f7f\u7528\u5b83\u6765\u4e3a\u6bcf\u4e00\u4e2aHTTPS\u8fde\u63a5\u786e\u8ba4\u8bc1\u4e66\u7684\u5408\u6cd5\u6027\u3002\n\u5bf9\u672c\u5c0f\u8282\u793a\u4f8b\u800c\u8a00\uff0c\u53ea\u662f\u4e3a\u4e86\u6d4b\u8bd5\uff0c\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u81ea\u7b7e\u540d\u7684\u8bc1\u4e66\uff0c\u4e0b\u9762\u662f\u4e3b\u8981\u6b65\u9aa4\uff1a"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Generating a 1024 bit RSA private key\n\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026++++++\n\u2026++++++"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "writing new private key to \u2018server_key.pem\u2019"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "You are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nIf you enter \u2018.\u2019, the field will be left blank."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Country Name (2 letter code) [AU]:US\nState or Province Name (full name) [Some-State]:Illinois\nLocality Name (eg, city) []:Chicago\nOrganization Name (eg, company) [Internet Widgits Pty Ltd]:Dabeaz, LLC\nOrganizational Unit Name (eg, section) []:\nCommon Name (eg, YOUR name) []:localhost\nEmail Address []:\nbash %"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u5728\u521b\u5efa\u8bc1\u4e66\u7684\u65f6\u5019\uff0c\u5404\u4e2a\u503c\u7684\u8bbe\u5b9a\u53ef\u4ee5\u662f\u4efb\u610f\u7684\uff0c\u4f46\u662f\u201dCommon Name\u201c\u7684\u503c\u901a\u5e38\u8981\u5305\u542b\u670d\u52a1\u5668\u7684DNS\u4e3b\u673a\u540d\u3002\n\u5982\u679c\u4f60\u53ea\u662f\u5728\u672c\u673a\u6d4b\u8bd5\uff0c\u90a3\u4e48\u5c31\u4f7f\u7528\u201dlocalhost\u201c\uff0c\u5426\u5219\u4f7f\u7528\u670d\u52a1\u5668\u7684\u57df\u540d\u3002"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u670d\u52a1\u5668\u8bc1\u4e66\u6587\u4ef6server_cert.pem\u5185\u5bb9\u7c7b\u4f3c\u4e0b\u9762\u8fd9\u6837\uff1a"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u2014\u2013BEGIN CERTIFICATE\u2014\u2013\nMIIC+DCCAmGgAwIBAgIJAPMd+vi45js3MA0GCSqGSIb3DQEBBQUAMFwxCzAJBgNV\nBAYTAlVTMREwDwYDVQQIEwhJbGxpbm9pczEQMA4GA1UEBxMHQ2hpY2FnbzEUMBIG\nA1UEChMLRGFiZWF6LCBMTEMxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xMzAxMTEx\nODQyMjdaFw0xNDAxMTExODQyMjdaMFwxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhJ\nbGxpbm9pczEQMA4GA1UEBxMHQ2hpY2FnbzEUMBIGA1UEChMLRGFiZWF6LCBMTEMx\nEjAQBgNVBAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA\nmawjS6BMgChfn/VDXBWs+TrGuo3+6pG1JfLIucUK2N2WAu47rpy9XWS5/1WxBSCE\n2lDoLwbT79alFkyRsIGutlUhtaBRNDgyMd4NjYeLEX/q8krMdi+OONp8dM+DubyU"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "O5OnkTRwGVFJwi+dPmL48i8re68i0o0rioQnCbG2YD8CAwEAAaOBwTCBvjAdBgNV\nHQ4EFgQUrtoLHHgXiDZTr26NMmgKJLJLFtIwgY4GA1UdIwSBhjCBg4AUrtoLHHgX\niDZTr26NMmgKJLJLFtKhYKReMFwxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhJbGxp\nbm9pczEQMA4GA1UEBxMHQ2hpY2FnbzEUMBIGA1UEChMLRGFiZWF6LCBMTEMxEjAQ\nBgNVBAMTCWxvY2FsaG9zdIIJAPMd+vi45js3MAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQEFBQADgYEAFci+dqvMG4xF8UTnbGVvZJPIzJDRee6Nbt6AHQo9pOdAIMAu\nWsGCplSOaDNdKKzl+b2UT2Zp3AIW4Qd51bouSNnR4M/gnr9ZD1ZctFd3jS+C5XRp\nD3vvcW5lAnCCC80P6rXy7d7hTeFu5EYKtRGXNvVNd/06NALGDflrrOwxF3Y=\n\u2014\u2013END CERTIFICATE\u2014\u2013"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u5728\u670d\u52a1\u5668\u7aef\u4ee3\u7801\u4e2d\uff0c\u79c1\u94a5\u548c\u8bc1\u4e66\u6587\u4ef6\u4f1a\u88ab\u4f20\u7ed9SSL\u76f8\u5173\u7684\u5305\u88c5\u51fd\u6570\u3002\u8bc1\u4e66\u6765\u81ea\u4e8e\u5ba2\u6237\u7aef\uff0c\n\u79c1\u94a5\u5e94\u8be5\u5728\u4fdd\u5b58\u5728\u670d\u52a1\u5668\u4e2d\uff0c\u5e76\u52a0\u4ee5\u5b89\u5168\u4fdd\u62a4\u3002"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u5728\u5ba2\u6237\u7aef\u4ee3\u7801\u4e2d\uff0c\u9700\u8981\u4fdd\u5b58\u4e00\u4e2a\u5408\u6cd5\u8bc1\u4e66\u6388\u6743\u6587\u4ef6\u6765\u786e\u8ba4\u670d\u52a1\u5668\u8bc1\u4e66\u3002\n\u5982\u679c\u4f60\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5728\u5ba2\u6237\u7aef\u590d\u5236\u4e00\u4efd\u670d\u52a1\u5668\u7684\u8bc1\u4e66\u5e76\u4f7f\u7528\u5b83\u6765\u786e\u8ba4\u3002\n\u8fde\u63a5\u5efa\u7acb\u540e\uff0c\u670d\u52a1\u5668\u4f1a\u63d0\u4f9b\u5b83\u7684\u8bc1\u4e66\uff0c\u7136\u540e\u4f60\u5c31\u80fd\u4f7f\u7528\u5df2\u7ecf\u4fdd\u5b58\u7684\u8bc1\u4e66\u6765\u786e\u8ba4\u5b83\u662f\u5426\u6b63\u786e\u3002"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u670d\u52a1\u5668\u4e5f\u80fd\u9009\u62e9\u662f\u5426\u8981\u786e\u8ba4\u5ba2\u6237\u7aef\u7684\u8eab\u4efd\u3002\u5982\u679c\u8981\u8fd9\u6837\u505a\u7684\u8bdd\uff0c\u5ba2\u6237\u7aef\u9700\u8981\u6709\u81ea\u5df1\u7684\u79c1\u94a5\u548c\u8ba4\u8bc1\u6587\u4ef6\u3002\n\u670d\u52a1\u5668\u4e5f\u9700\u8981\u4fdd\u5b58\u4e00\u4e2a\u88ab\u4fe1\u4efb\u8bc1\u4e66\u6388\u6743\u6587\u4ef6\u6765\u786e\u8ba4\u5ba2\u6237\u7aef\u8bc1\u4e66\u3002"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\u5982\u679c\u4f60\u8981\u5728\u771f\u5b9e\u73af\u5883\u4e2d\u4e3a\u4f60\u7684\u7f51\u7edc\u670d\u52a1\u52a0\u4e0aSSL\u7684\u652f\u6301\uff0c\u8fd9\u5c0f\u8282\u53ea\u662f\u4e00\u4e2a\u5165\u95e8\u4ecb\u7ecd\u800c\u5df2\u3002\n\u4f60\u8fd8\u5e94\u8be5\u53c2\u8003\u5176\u4ed6\u7684\u6587\u6863\uff0c\u505a\u597d\u82b1\u8d39\u4e0d\u5c11\u65f6\u95f4\u6765\u6d4b\u8bd5\u5b83\u6b63\u5e38\u5de5\u4f5c\u7684\u51c6\u5907\u3002\u53cd\u6b63\uff0c\u5c31\u662f\u5f97\u6162\u6162\u6298\u817e\u5427~ ^_^"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.1"
    },
    "toc": {
      "base_numbering": 1,
      "nav_menu": {},
      "number_sections": true,
      "sideBar": true,
      "skip_h1_title": true,
      "title_cell": "Table of Contents",
      "title_sidebar": "Contents",
      "toc_cell": false,
      "toc_position": {},
      "toc_section_display": true,
      "toc_window_display": true
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}